from flask.ext.sqlalchemy import SQLAlchemy
from flask import Flask

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://root:OHciFI_si2@61.155.169.86/test'
app.config['SQLALCHEMY_COMMIT_ON_TEARDOWN'] = True

db = SQLAlchemy(app)

class Role(db.Model):
	__tablename__ = 't_m_role'
	id = db.Column(db.Integer, primary_key=True)
	name = db.Column(db.String(128))

	def __repr__(self):
		return '<Role %r>' % self.name

class User(db.Model):
	__tablename__ = 't_m_user'
	id = db.Column(db.Integer, primary_key=True)
	username = db.Column(db.String(128), unique=True)
	password = db.Column(db.String(128))
	type = db.Column(db.Integer)
	role_id = db.Column(db.Integer)
	create_time = db.Column(db.DateTime)

	def __repr__(self):
		return '<User %r>' % self.username
